Fix memory leak in dependency nodes#26
Conversation
Dependency nodes should regularly cleanup their dependent nodes references in order to remove the ones that point to GC'ed dependents
4f54333 to
4d14961
Compare
|
@xrcat please have a look |
|
@not-azat please have a look too. |
There was a problem hiding this comment.
why it is not in AbstractCache?
There was a problem hiding this comment.
There are two different concepts:
Cache- takes care of storing the data and accessing it;DependencyNode- takes care about dependencies.
There are few implementations XXXInlineDependencyCache that implement both Cache and DependencyNode. This reduces the memory overhead of caching in some simple cases.
But cleanupIfNeeded stuff is not part of Cache contract, so AbstractCache has nothing to do with that.
There was a problem hiding this comment.
May be create helper class? Too much code duplicating.
There was a problem hiding this comment.
This class is a template, others are autogenerated from this template.
It doesn't seem reasonable to create some kind of helper for a single method or add one more class to the hierarchy.
Code generation is bad, I know. But there's no other way to have high performance with primitives in Java.
|
As I've mentioned custom HashSet looks like best alternative. |
|
Ok, we've decided to merge it as-is. |
Fix memory leak in dependency nodes
Dependency nodes should regularly cleanup their dependent nodes references in order to remove the ones that point to GC'ed dependents